package com.ocom.payhandle.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ocom.common.entity.payconfig.EntityForecastData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface IDaoForecastData extends BaseMapper<EntityForecastData> {
    @Select("select  ${ew.sqlSelect}" +
            " from  forecast_data f " +
            "left join  personnel_info p  on f.com_id=p.com_id  and f.p_id =p.p_id " +
            "left join dept_info d on d.dept_id=p.dept_id  ${ew.customSqlSegment} ")
    IPage<Map<String,Object>> getForecastData(Page<?> page, @Param("meal0") String meal0, @Param("meal1") String meal1, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("SELECT  ${ew.sqlSelect}" +
            " from  forecast_data fd" +
            " left join  personnel_info p  on fd .com_id=p.com_id  and fd.p_id =p.p_id " +
            " left join dept_info di on  di.com_id=p.com_id  and di.dept_id =p.dept_id" +
            "  ${ew.customSqlSegment}")
    List<Map<String,Object>> summary(@Param("meal0") String meal0, @Param("meal1") String meal1, @Param(Constants.WRAPPER) Wrapper wrapper);
}
